package com.sx.micowell.framework.view.dialog;

import android.app.Activity;
import android.view.View;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.sx.micowell.R;
import com.sx.micowell.framework.adapter.ExceptionAdapter;
import com.sx.micowell.framework.tools.cmd.CmdException;
import com.sx.widget.app.dialog.BaseDialog;

import java.util.List;

/**
 * @Description
 * @Author 梁浩文
 * @Date 2021/9/17 11:31
 */
public class DialogException {
    public static final class Builder
            extends BaseDialog.Builder<DialogException.Builder> {
        RecyclerView recyclerView;

        public Builder(Activity activity) {
            super(activity);
            setContentView(R.layout.dialog_exception);
            setCancelable(false);
            setCanceledOnTouchOutside(false);
            findViewById(R.id.end_sport).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    dismiss();
                }
            });
            recyclerView = this.<RecyclerView>findViewById(R.id.list);
            recyclerView.setLayoutManager(new LinearLayoutManager(activity));
        }

        private ExceptionAdapter exceptionAdapter;

        public Builder setCmdExceptionList(List<CmdException> list) {
            exceptionAdapter = new ExceptionAdapter(list);
            recyclerView.setAdapter(exceptionAdapter);
            return this;
        }
    }

}
